/**
 * @USER: Administrator
 * @DATE: 2024/9/21 上午10:44
 * @VERSION: 1.0.0
 */
public class LC832 {
    public static void main(String[] args) {

    }
    public int[][] flipAndInvertImage(int[][] image) {
        // 翻转每一行
        for (int[] ints : image) {
            for (int i = 0; i < ints.length/2; i++) {
                int temp = ints[i];
                ints[i] = ints[ints.length-1-i];
                ints[ints.length-1-i] = temp;
            }
        }

        // 反转
        for (int i = 0; i < image.length; i++) {
            for (int j = 0; j < image[i].length; j++) {
                image[i][j] = image[i][j]^1;
            }
        }

        return image;
    }
}
